package com.shanyin.framework.common.util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.shanyin.framework.common.model.SysConfig;
import com.shanyin.framework.common.sys.SysConfigService;

/***
 ** @category 缓存工具类(缓存的都是指定好的数据配置)...
 ** @author qing.yunhui
 ** @email: 280672161@qq.com
 ** @createTime: 2018年5月29日上午11:13:24
 **/
public class CacheUtil {
	
	 private static final Logger logger = LoggerFactory.getLogger(CacheUtil.class);

	 @Autowired
	 RedissLockUtil redissLockUtil; 
	 
	 
    /**
     * 初始化系统参数配置
     */
	 private static void initSysConfig() {
        logger.info("初始化系统配置Config...");

        // 系统配置Config缓存
        SysConfigService sysConfigService = (SysConfigService) SpringBeanUtil.getBean("sysConfigService");

        Map<String, String> configMap = new HashMap<String, String>();

        List<SysConfig> sysConfigs = sysConfigService.query(null);
        for (SysConfig sysConfig : sysConfigs) {
            if (null != sysConfig && StringUtil.isNotEmptys(sysConfig.getCode())) {
                configMap.put(sysConfig.getCode(),sysConfig.getValue());
            }
        }
//        Global.del();
//        Global.set(configMap);
     }
	 
	 

}
